home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / utility / csap421.zip / GETDPB.C < prev    next >
C/C++ Source or Header  |  1993-09-09  |  786b  |  28 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <dos.h>
  4.  
  5. #include "dosstruc.h"
  6.  
  7. /*
  8.  * GETDPB is a routine to use the undocumented PC/MS-DOS Int 21H, Func 32H to
  9.  * obtain disk information.  This function has been verified to perform
  10.  * correctly in all versions of PC/MS-DOS from 2.0 through 3.3.  Since it is
  11.  * heavily used by DOS programs such as CHKDSK, it will prbably continue to
  12.  * work correctly.  This routine is used to avoid problems with non-standard
  13.  * boot sectors.
  14.  */
  15.  
  16.  void
  17. GetDPB (int Disk, struct DpbStruct * Dpb) {
  18.     union REGS      Regs;
  19.     struct SREGS    SRegs;
  20.  
  21.     segread(&SRegs);
  22.     Regs.h.ah = 0x32;
  23.     if (Disk) Disk -= '@';
  24.     Regs.h.dl = Disk;
  25.     intdosx(&Regs, &Regs, &SRegs);
  26.     movedata(SRegs.ds, Regs.x.bx, FP_SEG(Dpb), FP_OFF(Dpb), 28);
  27. }
  28.